package Server;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.hibernate.Session;
import org.hibernate.SessionFactory;

import DAO.DAO_Local;
import Entities.Entity_Empleado;
import Entities.Entity_Local;
import Entities.Entity_Mesa;
import Entities.Entity_Mozo;
import Entities.Entity_Salon;
import Entities.Entity_Sector;
import Hibernate.HibernateUtil;


public class Test {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		SessionFactory sf = HibernateUtil.getSessionFactory();
		
		
		Entity_Local l = new Entity_Local();
		Entity_Salon sa = new Entity_Salon();
		Entity_Sector s = new Entity_Sector();
		
		Entity_Mesa m = new Entity_Mesa();
		Entity_Mesa m2 = new Entity_Mesa();
		Entity_Mesa m3 = new Entity_Mesa();
		m.setNumero(1);
		m.setEstado("Disponible");
		m2.setNumero(2);
		m2.setEstado("Disponible");
		m3.setNumero(3);
		m3.setEstado("Ocupada");
		
		List<Entity_Mesa> mesas = new ArrayList<Entity_Mesa>();
		mesas.add(m);
		mesas.add(m2);
		mesas.add(m3);
		
		s.setMesas(mesas);
		List<Entity_Sector> sectores = new ArrayList<Entity_Sector>();
		sectores.add(s);
		sa.setSectores(sectores);
		
		Entity_Mozo mozo = new Entity_Mozo();
		List<Entity_Empleado> mozos = new ArrayList<Entity_Empleado>();
		mozos.add(mozo);
		l.setEmpleados(mozos);
		l.setSalon(sa);
		

		Session se = sf.openSession();
		se.beginTransaction();

		se.persist(l);

		se.flush();
		se.getTransaction().commit();
		se.close();
		
		
		DAO_Local dao_Local = DAO_Local.getInstancia();
		dao_Local.getLocales();
	}

}
